home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / shells / scsh-0.4 / scsh-0 / scsh-0.4.2 / scsh / ultrix / tty-consts.scm < prev    next >
Text File  |  1995-10-31  |  8KB  |  217 lines

  1. ;;; Constant definitions for tty control code (POSIX termios).
  2. ;;; Copyright (c) 1995 by Brian Carlstrom.
  3. ;;; Largely rehacked by Olin.
  4.  
  5. ;;; These constants are for Ultrix 4.2
  6. ;;; and are taken from /usr/include/sys/termio.h
  7. ;;;            and /usr/include/sys/termios.h
  8. ;;;            and /usr/include/sys/ttydev.h
  9.  
  10. ;;; Non-standard (POSIX, SVR4, 4.3+BSD) things:
  11. ;;; - Some of the baud rates.
  12.  
  13.  
  14. ;;; Special Control Characters 
  15. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  16. ;;;  Indices into the c_cc[] character array.
  17.  
  18. ;;;    Name                 Subscript    Enabled by 
  19. ;;;     ----                 ---------    ----------
  20. ;;;  POSIX
  21. (define ttychar/eof        4)        ; ^d icanon
  22. (define ttychar/eol        5)        ;    icanon
  23. (define ttychar/delete-char    2)        ; ^? icanon
  24. (define ttychar/delete-line    3)        ; ^u icanon
  25. (define ttychar/interrupt    0)        ; ^c isig
  26. (define ttychar/quit        1)        ; ^\ isig
  27. (define ttychar/suspend        10)        ; ^z isig
  28. (define ttychar/start        12)        ; ^q ixon, ixoff
  29. (define ttychar/stop        11)        ; ^s ixon, ixoff
  30. (define ttychar/min        8)        ;    !icanon    ; Not exported
  31. (define ttychar/time        9)        ;    !icanon    ; Not exported
  32.  
  33. ;;; SVR4 & 4.3+BSD
  34. (define ttychar/delete-word    16)        ; ^w icanon
  35. (define ttychar/reprint     14)        ; ^r icanon
  36. (define ttychar/literal-next    17)        ; ^v iexten
  37. (define ttychar/discard        #f)        ; ^o iexten
  38. (define ttychar/delayed-suspend    13)        ; ^y isig
  39. (define ttychar/eol2        6)        ;    icanon
  40.  
  41. ;;; 4.3+BSD
  42. (define ttychar/status        #f)        ; ^t icanon 
  43.  
  44. ;;; Length of control-char string -- *Not Exported*
  45. (define    num-ttychars        19)
  46.  
  47. ;;; Magic "disable feature" tty character
  48. (define disable-tty-char (ascii->char #x00))    ; _POSIX_VDISABLE
  49.  
  50. ;;; Flags controllling input processing
  51. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  52.  
  53. ;;;  POSIX
  54. (define ttyin/ignore-break        #o00001)    ; ignbrk
  55. (define ttyin/interrupt-on-break    #o00002)    ; brkint
  56. (define ttyin/ignore-bad-parity-chars    #o00004)    ; ignpar
  57. (define ttyin/mark-parity-errors    #o00010)    ; parmrk
  58. (define ttyin/check-parity        #o00020)    ; inpck
  59. (define ttyin/7bits            #o00040)    ; istrip
  60. (define ttyin/nl->cr            #o00100)    ; inlcr
  61. (define ttyin/ignore-cr            #o00200)    ; igncr
  62. (define ttyin/cr->nl            #o00400)    ; icrnl
  63. (define ttyin/output-flow-ctl        #o02000)    ; ixon
  64. (define ttyin/input-flow-ctl        #o10000)    ; ixoff
  65.  
  66. ;;; SVR4 & 4.3+BSD
  67. (define ttyin/xon-any           #o4000)    ; ixany: Any char restarts after stop
  68. (define ttyin/beep-on-overflow #f)    ; imaxbel: queue full => ring bell
  69.  
  70. ;;; SVR4
  71. (define ttyin/lowercase           #o1000)    ; iuclc: Map upper-case to lower case
  72.  
  73.  
  74. ;;; Flags controlling output processing
  75. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  76.  
  77. ;;;  POSIX 
  78. (define    ttyout/enable         #o000001)  ; opost: enable output processing
  79.  
  80. ;;; SVR4 & 4.3+BSD
  81. (define ttyout/nl->crnl         #o000004)    ; onlcr: map nl to cr-nl
  82.  
  83. ;;; 4.3+BSD
  84. (define ttyout/discard-eot     #f)        ; onoeot
  85. (define ttyout/expand-tabs     #f)        ; oxtabs (NOT xtabs)
  86.  
  87. ;;; SVR4
  88. (define ttyout/cr->nl         #o000010)    ; ocrnl
  89. (define ttyout/fill-w/del     #o000200)    ; ofdel
  90. (define ttyout/delay-w/fill-char #o000100)    ; ofill
  91. (define ttyout/uppercase     #o000002)    ; olcuc
  92. (define ttyout/nl-does-cr     #o000040)    ; onlret
  93. (define ttyout/no-col0-cr     #o000020)    ; onocr
  94.  
  95. ;;; Newline delay
  96. (define    ttyout/nl-delay        #o000400)    ; mask (nldly)
  97. (define     ttyout/nl-delay0    #o000000)
  98. (define     ttyout/nl-delay1    #o000400)    ; tty 37 
  99.  
  100. ;;; Horizontal-tab delay
  101. (define    ttyout/tab-delay    #o006000)    ; mask (tabdly)
  102. (define     ttyout/tab-delay0    #o000000)
  103. (define     ttyout/tab-delay1    #o000000)    ; tty 37 
  104. (define     ttyout/tab-delay2    #o000000)
  105. (define     ttyout/tab-delayx    #o006000)    ; Expand tabs (xtabs, tab3)
  106.  
  107. ;;; Carriage-return delay
  108. (define    ttyout/cr-delay        #o030000)    ; mask (crdly)
  109. (define     ttyout/cr-delay0    #o000000)
  110. (define     ttyout/cr-delay1    #o010000)    ; tn 300 
  111. (define     ttyout/cr-delay2    #o020000)    ; tty 37 
  112. (define     ttyout/cr-delay3    #o030000)    ; concept 100 
  113.  
  114. ;;; Vertical tab delay 
  115. (define    ttyout/vtab-delay    #o001000)    ; mask (vtdly)
  116. (define     ttyout/vtab-delay0    #o000000)
  117. (define     ttyout/vtab-delay1    #o001000)    ; tty 37 
  118.  
  119. ;;; Backspace delay
  120. (define    ttyout/bs-delay        #o020000)    ; mask (bsdly)
  121. (define     ttyout/bs-delay0    #o000000)
  122. (define     ttyout/bs-delay1    #o020000)
  123.  
  124. ;;; Form-feed delay
  125. (define ttyout/ff-delay        #o100000)    ; mask (ffdly)
  126. (define     ttyout/ff-delay0    #o000000)
  127. (define     ttyout/ff-delay1    #o100000)
  128.  
  129. (define    ttyout/all-delay
  130.   (bitwise-ior (bitwise-ior (bitwise-ior ttyout/nl-delay ttyout/tab-delay)
  131.                 (bitwise-ior ttyout/cr-delay ttyout/vtab-delay))
  132.            (bitwise-ior ttyout/bs-delay ttyout/ff-delay)))
  133.  
  134.  
  135. ;;; Control flags - hacking the serial-line.
  136. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  137.  
  138. ;;;  POSIX
  139. (define ttyc/char-size        #o00060)    ; csize: character size mask 
  140. (define  ttyc/char-size5    #o00000)    ; 5 bits (cs5)
  141. (define  ttyc/char-size6    #o00020)    ; 6 bits (cs6)
  142. (define  ttyc/char-size7    #o00040)    ; 7 bits (cs7)
  143. (define  ttyc/char-size8    #o00060)    ; 8 bits (cs8)
  144. (define ttyc/2-stop-bits    #o00100)    ; cstopb: Send 2 stop bits.
  145. (define ttyc/enable-read    #o00200)    ; cread: Enable receiver.
  146. (define ttyc/enable-parity    #o00400)    ; parenb
  147. (define ttyc/odd-parity        #o01000)    ; parodd
  148. (define ttyc/hup-on-close    #o02000)    ; hupcl: Hang up on last close.
  149. (define ttyc/no-modem-sync    #o04000)    ; clocal: Ignore modem lines.
  150.  
  151. ;;;  4.3+BSD
  152. (define    ttyc/ignore-flags     #f)    ; cignore: ignore control flags 
  153. (define ttyc/CTS-output-flow-ctl #f)    ; ccts_oflow: CTS flow control of output
  154. (define ttyc/RTS-input-flow-ctl  #f)    ; crts_iflow: RTS flow control of input
  155. (define ttyc/carrier-flow-ctl     #f)    ; mdmbuf
  156.  
  157. ;;; Local flags -- hacking the tty driver / user interface.
  158. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  159.  
  160. ;;;  POSIX
  161. (define ttyl/visual-delete    #o020)    ; echoe: Visually erase chars
  162. (define ttyl/echo-delete-line #o040)    ; echok: Echo nl after line kill
  163. (define ttyl/echo          #o010)    ; echo:  Enable echoing
  164. (define ttyl/echo-nl          #o100)    ; echonl: Echo nl even if echo is off
  165. (define ttyl/canonical          #o002)    ; icanon: Canonicalize input
  166. (define ttyl/enable-signals   #o001)    ; isig: Enable ^c, ^z signalling
  167. (define ttyl/extended          #o400)    ; iexten:  Enable extensions
  168. (define ttyl/ttou-signal      #f)    ; tostop: SIGTTOU on background output
  169. (define ttyl/no-flush-on-interrupt #o200) ; noflsh
  170.  
  171. ;;; SVR4 & 4.3+BSD
  172. (define ttyl/visual-delete-line    #f) ; echoke: visually erase a line-kill 
  173. (define ttyl/hardcopy-delete    #f) ; echoprt: visual erase for hardcopy 
  174. (define ttyl/echo-ctl        #f) ; echoctl: echo control chars as "^X" 
  175. (define ttyl/flush-output    #f) ; flusho: output is being flushed
  176. (define ttyl/reprint-unread-chars #f) ; pendin: retype pending input
  177.  
  178. ;;; 4.3+BSD
  179. (define ttyl/alt-delete-word    #f)    ; altwerase
  180. (define ttyl/no-kernel-status    #f)    ; nokerninfo: no kernel status on ^T
  181.  
  182. ;;; SVR4
  183. (define ttyl/case-map #o4)    ; xcase: canonical upper/lower presentation
  184.  
  185. ;;; Vector of (speed . code) pairs.
  186.  
  187. (define baud-rates '#((0  . 0)        (1  . 50)    (2  .    75)
  188.               (3  . 110)    (4  . 134)    (5  .   150)
  189.               (6  . 200)    (7  . 300)    (8  .   600)
  190.               (9  . 1200)    (10 . 1800)     (11 .  2400)    
  191.               (12 . 4800)       (13 . 9600)    (14 .  exta)
  192.               (15 .  extb)))
  193.  
  194. ;;; tcflush() constants
  195. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  196.  
  197. (define %flush-tty/input  0)    ; TCIFLUSH
  198. (define %flush-tty/output 1)    ; TCOFLUSH
  199. (define %flush-tty/both      2)    ; TCIOFLUSH
  200.  
  201.  
  202. ;;; tcflow() constants
  203. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  204.  
  205. (define %tcflow/start-out 1)    ; TCOON
  206. (define %tcflow/stop-out  0)    ; TCOOFF
  207. (define %tcflow/start-in  3)    ; TCION
  208. (define %tcflow/stop-in   2)    ; TCIOFF
  209.  
  210.  
  211. ;;; tcsetattr() constants
  212. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  213.  
  214. (define %set-tty-info/now    0)    ; TCSANOW   Make change immediately.
  215. (define %set-tty-info/drain    1)    ; TCSADRAIN Drain output, then change.
  216. (define %set-tty-info/flush    2)    ; TCSAFLUSH Drain output, flush input.
  217.